<template>
<div class="content">
  <div class="welcome-container">
    <img class="logo-image" src="@/assets/img/logo.png" alt="Logo" />
    <div class="text main-text">欢迎使用 {{this.$project.projectName}}</div>
    <p class="sub-text">基于Spring Boot的水果超市管理系统</p>
  </div>
</div>
</template>

<script>
import router from '@/router/router-static'
export default {
  mounted(){
    this.init();
  },
  methods:{
    init(){
        if(this.$storage.get('Token')){
        this.$http({
            url: `${this.$storage.get('sessionTable')}/session`,
            method: "get"
        }).then(({ data }) => {
            if (data && data.code != 0) {
            router.push({ name: 'login' })
            }
        });
        }else{
            router.push({ name: 'login' })
        }
    }
  }
};
</script>

<style lang="scss" scoped>
.content {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 500px;
  text-align: center;
  background-color: #f5f7fa;
}

.welcome-container {
  padding: 40px;
  border-radius: 8px;
  background-color: white;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  max-width: 600px;
  width: 80%;
}

.logo-image {
  width: 120px;
  height: auto;
  margin-bottom: 30px;
}

.main-text {
  font-size: 32px;
  font-weight: bold;
  color: #409EFF;
  margin-bottom: 20px;
}

.sub-text {
  font-size: 18px;
  color: #606266;
}
</style>